<?php
    // array for JSON response
    $response = array();
    // include db connect class
    require_once __DIR__ . '/db_connect.php';
    // connecting to db
    $db = new DB_CONNECT();
    // get info place from place table
    if(isset($_GET['id'])){
        $result = mysql_query("SELECT * FROM place WHERE place_id =".$_GET['id']) or die(mysql_error());
        if (mysql_num_rows($result) > 0) {
                $response["place"] = array();
                while ($row = mysql_fetch_array($result)) {
                        $place = array(); 
                        $place['place_id'] = $row['place_id'];
                        $place['place_name'] = $row['place_name'];
                        $place['url_image'] = $row['url_image'];
                        $place['description'] = $row['description'];
                        // push single product into final response array
                        array_push($response['place'],$place);
                }
                // success
            $response["success"] = 1;
                echo json_encode($response);
        }
        else{
            $response["place"] = "No place";
            $response["success"] = 0;
                echo json_encode($response);
        }
    }
?>
